<?php
	function mostrar_tabla($nombre_tabla, $campos_tabla, $clave_busqueda)
	{
		include "conexion_bd.php";
		$mysqli->set_charset("utf8");
		$campos = '';
		foreach($campos_tabla as &$a) $campos = $campos.$a.',';
		$campos = substr($campos, 0,-1);
		print '</br><table id = "myTable" class="table table-bordered table-hover table-condensed table-responsive tablesorter"><thead><tr>';
		$r = $mysqli->query("SELECT ".$campos." FROM ".$nombre_tabla.";");
		while ($fila = $r->fetch_field())
		{
			//print '<th>'.$fila->name.'<link class="glyphicon glyphicon-resize-vertical pull-right"/></th>';
			print '<th>'.$fila->name.'</th>';
		}
		print '<th width="40"></th></tr></thead><tbody>';
		$r = $mysqli->query("SELECT ".$campos." FROM ".$nombre_tabla.";");
		while ($fila = $r->fetch_assoc())
		{
			print '</tr>';
			foreach($fila as &$a) print '<td><a onclick = "carga(\''.$fila[$clave_busqueda].'\',\''.$nombre_tabla.'\',\''.$clave_busqueda.'\')" href="#">'.$a.'</td>';
			print '<td><input name="registro[]" type = "checkbox" value = "'.$fila[$clave_busqueda].'"></td></tr>';
		}
		print '</tbody></table></br>';
	}
?>